<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="css/aui.css">
    <link rel="stylesheet" href="css/style.css">
    <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="js/init.js"></script>
    <title>收益明细</title>
    <link rel="stylesheet" href="css/double-date.css" />
    <script src="js/double-date.js"></script>
    <style>
        .pos_top{position: fixed;width: 100%;top:1rem;left:0;height: 2.4rem;background: #f3f3f3;padding: 0 .2rem}
    </style>
</head>
<body>
<header>
    <a href="javascript:history.back(-1)" class="f1 head-back" ></a>
    <div class="f8">收益明细</div>
    <div class="f1"></div>
</header>
<section class="bg-gray">
    
    <!--回到顶部-->
    <a href="#top" class="ab col-1 bg-black-5 border-radius-1 pad-2" style="right: .2rem;bottom: 1.5rem;z-index: 2">
        <img class="col-10" src="img/backtop.png" alt="">
    </a>

    
    <div class="pad-2 re" id="top">
        <!--菜单固定-->
        <!--<div class="pos_top">-->
            <ul class="flex flex-r-w mar-t-3">
                <li class="pad-1-2 bg-white border-radius-1 border-gray" onclick="allclick()">全部</li>
                <li class="pad-1-2 bg-white border-radius-1 border-gray" onclick="selectlist(3)">分享收益</li>
                <li class="pad-1-2 bg-white border-radius-1 border-gray" onclick="selectlist(4)">盟主奖</li>
                <li class="pad-1-2 bg-white border-radius-1 border-gray" >转账（出）</li>
                <li class="pad-1-2 bg-white border-radius-1 border-gray">转账（入）</li>
                <li class="pad-1-2 bg-white border-radius-1 border-gray" onclick="selectlist(7)">提现</li>
                <li class="pad-1-2 bg-white border-radius-1 border-gray" onclick="selectlist(1)">充值</li>
                <!--<li class="pad-1-2 bg-white border-radius-1 border-gray" onclick="selectlist()">注册</li>-->
            </ul>
            <div class="right ">
                <a href="javascript:location.reload()" class="inline-block bg-white pad-1-2 border-radius-1">
                    <img class="" src="img/icon1.png" alt="" width="20">
                </a>
            </div>

            <!--<div class="flex pad-t-b-3 flex-stretch">
                <input class="mar-l-5 f1 bg-white border-gray border-radius-1 pad-1-2 mar-r-2" type="search" placeholder="搜索">
                <ul class="col-3 bg-white border-gray border-radius-1 flex">
                    <a href="javascript:location.reload()" class="f1 border-r-gray">
                        <img class="col-3 auto" src="img/icon1.png" alt="" >
                    </a>
                    <li class="f1">
                        <img class="col-5 auto" src="img/icon2.png" alt="" >
                    </li>
                </ul>
            </div>-->

        <!--</div> -->

        <!--<div class="flex">
            <ul style="flex:1;">
                <li class="flex mar-b-1 re">
                    <span class="mar-l-r-2">开始</span>
                    &lt;!&ndash;<input class="f1 bg-white pad-1-2 border-gray" type="number">&ndash;&gt;
                    &lt;!&ndash;日期选择器&ndash;&gt;
                    <div class=" date date1 fl" id="from">
                        <input type="text" class="date-check" value="2015/6/15" />
                    </div>
                    <i class="bg-gray-d border-gray"><img src="" alt=""></i>

                </li>
                <li class="flex mar-b-1">
                    <span class="mar-l-r-2">结束</span>
                    &lt;!&ndash;<input class="f1 bg-white pad-1-2 border-gray" type="number">&ndash;&gt;
                    &lt;!&ndash;日期选择器&ndash;&gt;
                    <div class="date fr" id="to">
                        <input type="text" class="date-check" value="2017-10-11" />
                    </div>
                    <i class="bg-gray-d border-gray"><img src="" alt=""></i>

                </li>
            </ul>
            <span class="pad-2-3 border-radius-1 bg-blue color-white mar-l-2">搜索</span>
        </div>-->




        <ul class="awardlist line-h-2 border-gray" data-now="1" data-num="2" >
            <!--<li class="border-b-gray">
                <div>
                    <p>序号</p>
                    <p>2019-07-22</p>
                </div>
                <div>
                    <p>受益会员</p>
                    <p>10.22</p>
                </div>
                <div>
                    <p>关联会员</p>
                    <p>2.11</p>
                </div>
                <div>
                    <p>类型</p>
                    <p>0.00</p>
                </div>
                <div>
                    <p>币种</p>
                    <p>0.00</p>
                </div>
                <div>
                    <p>金额</p>
                    <p>0.00</p>
                </div>
                <div>
                    <p>时间</p>
                    <p>0.00</p>
                </div>
                <div>
                    <p>备注</p>
                    <p>0.00</p>
                </div>
            </li>-->

        </ul>
        <p id="more" class="center pad-3" ></p>
    </div>

</section>

<script src="js/foot.js"></script>
<script>
    var data, page, pageall, type, currentpage;
    function loadpage() {
        var url;
        var data = {};
        data.userid = localStorage.user_id;
        data.token = localStorage.token;
        type?data.type = type: '';

        new AjaxRequest({
            type: 'post',
            data: data,
            dataType: 'json',
            url: hostUrl + 'index/Mycenter/bonus_details',
            callback: res => {

                if(res.status == 1){

                    page = res.data.data;

                    pageall = res.data.last_page;

                    itemcont(page, 1);

                }

            }
        });
    }
    loadpage();

    function itemcont(page, currentpage) {

        var list = '';

        for(var i=0;i<page.length;i++){
            list += '<li class="border-b-gray"><div><p>序号</p><p>'+(page[i].id?page[i].id:'')+'</p></div><div><p>受益会员</p><p>'+(page[i].user_id?page[i].user_id:'')+'</p></div><div><p>关联会员</p><p>'+(page[i].source_uid?page[i].source_uid:'')+'</p></div><div><p>类型</p><p>';

            list += page[i].type == 1?'充值':page[i].type == 2?'抢购冻结':page[i].type == 3?'利润':page[i].type == 4?'红利释放':page[i].type == 5?'资金解冻':page[i].type == 6?'崩盘亏损':page[i].type == 7?'提现':'';

            list += '</p></div><div><p>币种</p><p>'+(page[i].coin_type==1?'以太坊（ETH）':page[i].coin_type==2?'以太经典（ETC）':'')+'</p>';

            list += '</div><div><p>金额</p><p>'+(page[i].money?page[i].money:'')+'</p></div><div><p>时间</p><p>'+(page[i].creattime?page[i].creattime:'')+'</p></div><div><p>备注</p><p>'+(page[i].remark?page[i].remark:'')+'</p></div></li>';

        }

        if(currentpage>1){

            $(".awardlist").append(list);

        }else{

            $(".awardlist").html(list);

        }

    }

    function allclick() {
        type = null;
        lock = true;

        loadpage();

    }

    function selectlist(item) {

        type = item;
        lock = true;
        $(".awardlist").attr('data-now',1);
        $(document).scrollTop(0);
        loadpage();

    }

    var lock = true;
    // 下拉加载更多
    $('section').scroll(function () {

        if (pageall>1) {

            $("#more").show();

            currentpage = $(".awardlist").attr('data-now');

            var nowtop = $('section').scrollTop() + $(window).height() - 100;

            var moretop = $("#more").position().top;

            if(nowtop > moretop){
                if(lock){

                    lock = false;
                    currentpage ++;
                    $(".awardlist").attr('data-now',currentpage);
                    var data = {};
                    data.userid = localStorage.user_id;
                    data.token = localStorage.token;
                    type?data.type = type: '';
                    // console.log(data);
                    new AjaxRequest({
                        type: 'post',
                        dataType: 'json',
                        url: hostUrl + 'index/Mycenter/bonus_details?page=' + currentpage,
                        data: data,
                        callback: res => {
                            console.log(currentpage)

                            if(res.status == 1){

                                page = res.data.data;
                                pageall = res.data.last_page;

                                if(currentpage <= pageall){

                                    itemcont(page, currentpage);


                                    $("#more").text('加载更多...');
                                    lock = true;

                                }else{
                                    $("#more").text('没有更多数据...');
                                    lock = false;
                                    currentpage = 1;
                                }


                            }else{
                                toast(res.msg);
                            }
                        }
                    })
                }

            }

        }else{

            $("#more").hide();

        }

    })

</script>


</body>
</html>